package thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 * @author HuangJin
 * @version 1.0
 * describe:
 *  Thread提供了一个静态方法：
 *
 * @date 2023/3/14 16:26
 */
public class SleepDemo {
    public static void main(String[] args) throws IOException {
        System.out.println("程序开始了");
        /*Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字");
        Integer num = new Integer(sc.nextInt());*/
        BufferedReader br = new BufferedReader(
            new InputStreamReader(
                    System.in
            )
        );
        String line = br.readLine();
        int num = Integer.parseInt(line);
        try {
            for (;num>0;num--){
                System.out.println(num);
                Thread.sleep(1000);
            }
            System.out.println("时间到！");
            /*for (int i = num;i>=0;i--){
                Thread.sleep(1000);
                System.out.println("倒计时："+i+"s");
                if (i==0){
                    System.out.println("时间到");
                }
            }*/
            /*while (true){
                Thread.sleep(1000);
                System.out.println(num);
                num--;
                if (num == 0){
                    Thread.sleep(1000);
                    System.out.println("时间到");
                    break;
                }
            }*/
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("程序结束了");
    }
}
